Intro to QGIS | CEH Edinburgh
Phil Taylor & Ed Carnell
Oct 2019 / Feb 2020
Before we revisit the lessons learned in the training course, here are some tutorials and websites that may be useful as you practise your QGIS skills.
There are lots of online tutorials, with the following lessons covering a similar scope to content below:
We also worked with the Print Layout to produce a map output. This guide starts with the same procedure, then shows how this output can be automated:
Some other useful links we discussed:
Our training course used a specifically-designed training dataset set in Fiji. A copy of this can be downloaded here.
Below are a series of videos that show the processes we learned in the course, running through each step necessary in turn. See what you can remember from the course before watching each video - you may surprise yourself!
We’re starting off by importing the CSV file of point locations. Before importing a similar CSV, you need to be aware of these three things:
Projections are often referred to by their EPSG code. You can look up these codes and search for projections on epsg.io. As with all data importing, we start by going to Layer > Add Layer, and for CSV files we select ‘Add Delimited Text Layer..’
In the video below, we are importing our points from the .csv file we were provided. We were told the projection (aka ‘Geomoetry CRS’) this data was in (“Fiji Map Grid”) and it has already been selected in the example below - the little world icon next to the drop down menu can be clicked to deinfe a projection or select a different one:
The imported points are just a temporary layer in QGIS, so it’s a good idea to export them. Here we’re doing so as a GeoPackage (single file), but you can equally choose ‘ESRI Shapefile’ in the Format drop-down box - this is a proprietary, but widely used, format - it saves as multiple files. If you select ‘Add saved file to map’ then you can skip the re-import step. Otherwise, go to Layer > Add Layer > Add Vector Layer… and select your saved file.
In order to easily add background maps, we can install the QuickMapServices plugin. This is just the start, however! There are lots more map options available in the plugin’s settings, and XYZ tiles can be added for even more possibilities. This guide shows you how.
Points can easily be styled based on their attributes. In this example we are categorising based on a text field, giving each category a different coloured point. Right-click on the layer and go to Properties, then in the Symbology tab, select ‘Categorised’ in the top menu. From here, you just need to select the column of data (the attribute) you’d like to classify, then a preferred colour ramp. Once these have been selected, the ‘classify’ button below will style your points as desired.
Categorising data can be an easy way to see if there are any errors in a dataset. The video above showed a category for ‘Turtles’ as well as one for ‘Turtels’. This latter category is due to an error in the dataset, where the ‘Research Activity’ has been misspelled. The principle for editing any value is exactly the same.
Start by right-clicking on the layer and go to ‘Open Attribute Table’. You then need to click the Editing button (pencil) to allow attribute editing. Then you can simply click on the value you want to change and type in the correct one. Clicking the pencil again will stop editing mode and you will be asked to save your edits. The data can then be re-classified with the correct thematic classes using the guide above.
NB If you are editing data, it is a good idea to have the ‘Digitizing Toolbar’ added to QGIS. You can add this by right-clicking on any blank space in the top menus, then selecting it from the options. You’ll see some new buttons have been added to the top menu, which allow easy editing of spatial data and attributes - the video below shows how to add this toolbar, edit data and re-classify it:
Instead of categorising the data, we can also use numeric data to change the colour or size of the points. This is good for showing information on the scale of an attribute as well as its point location.
We can use numeric data to change the colour of the point - this is generally most useful when using one colour and changing its brightness (so small values are, say, light red, and large values are dark red).
Start by right-clicking on the layer and selecting Properties. Then in the Symbology tab, this time choose ‘Graduated’ in the top menu. You can select any column with numeric data, then in the ‘Method’ box, choose ‘Color’. Select a sensible color ramp, then choose your desired amount of classes in the ‘Classes’ box below, before pressing the ‘Classify’ button to see the result.
We can also use numeric data to change the size of the point - this is a very visual way to show the range in numeric values.
Start by right-clicking on the layer and selecting Properties. Then in the Symbology tab, again choose ‘Graduated’ in the top menu. You can select any column with numeric data, then in the ‘Method’ box, choose ‘Size’. Designate the range of sizes you want the points to be in the ‘Size from’ boxes, then choose your desired amount of classes in the ‘Classes’ box below, before pressing the ‘Classify’ button to see the result.
Once we were happy with how we’d styled our points and added a background map, we explored using ‘Print Layout’ (NB this was previously called ‘Print Composer’) to create outputs for publication. We styled our map with a legend, scale, north arrow and graticules, but there are many more options available. This guide shows how to add some of these features and exports the map to a suitable image format.
Finally, some of us explored some more advanced QGIS features, such as using the DTM to create a 3D terrain map of Fiji, as well as displaying some of our data points as towers based on their values - both using the qgis2threejs plugin.
If you’d like to learn more about using this plugin and creating some 3D outputs, then this excellent tutorial goes through the basic steps necessary.